home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #5 / Amiga Plus CD - 2000 - No. 5.iso / Tools / Dev / fpc / amigaunits / iffparse.pas < prev    next >
Pascal/Delphi Source File  |  2000-01-01  |  21KB  |  792 lines

  1. {
  2.     This file is part of the Free Pascal run time library.
  3.  
  4.     A file in Amiga system run time library.
  5.     Copyright (c) 1998-2000 by Nils Sjoholm
  6.     member of the Amiga RTL development team.
  7.  
  8.     See the file COPYING.FPC, included in this distribution,
  9.     for details about the copyright.
  10.  
  11.     This program is distributed in the hope that it will be useful,
  12.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  14.  
  15.  **********************************************************************}
  16.  
  17. unit iffparse;
  18.  
  19. INTERFACE
  20.  
  21. uses exec, clipboard, utility;
  22.  
  23.  
  24. const
  25.  
  26.     IFFPARSENAME  : PChar = 'iffparse.library';
  27.  
  28. {
  29.  * Struct associated with an active IFF stream.
  30.  * "iff_Stream" is a value used by the client's read/write/seek functions -
  31.  * it will not be accessed by the library itself and can have any value
  32.  * (could even be a pointer or a BPTR).
  33.  }
  34. Type
  35.        pIFFHandle = ^tIFFHandle;
  36.        tIFFHandle = record
  37.         iff_Stream,
  38.         iff_Flags   : ULONG
  39.         iff_Depth   : LONGINT;      {  Depth of context stack.  }
  40.         {  There are private fields hiding here.  }
  41.        END;
  42.  
  43. {
  44.  * Bit masks for "iff_Flags" field.
  45.  }
  46. CONST
  47.  IFFF_READ     =  0;                      { read mode - default }
  48.  IFFF_WRITE    =  1;                      { write mode }
  49.  IFFF_RWBITS   =  (IFFF_READ + IFFF_WRITE);        { read/write bits }
  50.  IFFF_FSEEK    =  2;                 { forward seek only }
  51.  IFFF_RSEEK    =  4;                 { random seek }
  52.  IFFF_RESERVED =  $FFFF0000;             { Don't touch these bits. }
  53.  
  54. {
  55.  * When the library calls your stream handler, you'll be passed a pointer
  56.  * to this structure as the "message packet".
  57.  }
  58. Type
  59.        pIFFStreamCmd = ^tIFFStreamCmd;
  60.        tIFFStreamCmd = record
  61.         sc_Command    : Longint;     {  Operation to be performed (IFFCMD_) }
  62.         sc_Buf        : Pointer;     {  Pointer to data buffer              }
  63.         sc_NBytes     : Longint;     {  Number of bytes to be affected      }
  64.        END;
  65. {
  66.  * A node associated with a context on the iff_Stack.  Each node
  67.  * represents a chunk, the stack representing the current nesting
  68.  * of chunks in the open IFF file.  Each context node has associated
  69.  * local context items in the (private) LocalItems list.  The ID, type,
  70.  * size and scan values describe the chunk associated with this node.
  71.  }
  72.        pContextNode = ^tContextNode;
  73.        tContextNode = record
  74.         cn_Node         : tMinNode;
  75.         cn_ID,
  76.         cn_Type,
  77.         cn_Size,        {  Size of this chunk             }
  78.         cn_Scan  : Longint;        {  # of bytes read/written so far }
  79.         {  There are private fields hiding here.  }
  80.        END;
  81.  
  82. {
  83.  * Local context items live in the ContextNode's.  Each class is identified
  84.  * by its lci_Ident code and has a (private) purge vector for when the
  85.  * parent context node is popped.
  86.  }
  87.        pLocalContextItem = ^tLocalContextItem;
  88.        tLocalContextItem = record
  89.         lci_Node        : tMinNode;
  90.         lci_ID,
  91.         lci_Type,
  92.         lci_Ident       : ULONG;
  93.         {  There are private fields hiding here.  }
  94.        END;
  95.  
  96. {
  97.  * StoredProperty: a local context item containing the data stored
  98.  * from a previously encountered property chunk.
  99.  }
  100.        pStoredProperty = ^tStoredProperty;
  101.        tStoredProperty = Record
  102.         sp_Size  : Longint;
  103.         sp_Data  : Pointer;
  104.        END;
  105.  
  106. {
  107.  * Collection Item: the actual node in the collection list at which
  108.  * client will look.  The next pointers cross context boundaries so
  109.  * that the complete list is accessable.
  110.  }
  111.        pCollectionItem = ^tCollectionItem;
  112.        tCollectionItem = record
  113.         ci_Next                 : pCollectionItem;
  114.         ci_Size                 : Longint;
  115.         ci_Data                 : Pointer;
  116.        END;
  117.  
  118. {
  119.  * Structure returned by OpenClipboard().  You may do CMD_POSTs and such
  120.  * using this structure.  However, once you call OpenIFF(), you may not
  121.  * do any more of your own I/O to the clipboard until you call CloseIFF().
  122.  }
  123.        pClipboardHandle = ^tClipBoardHandle;
  124.        tClipboardHandle = record
  125.         cbh_Req                 : tIOClipReq;
  126.         cbh_CBport,
  127.         cbh_SatisfyPort         : tMsgPort;
  128.        END;
  129.  
  130. {
  131.  * IFF return codes.  Most functions return either zero for success or
  132.  * one of these codes.  The exceptions are the read/write functions which
  133.  * return positive values for number of bytes or records read or written,
  134.  * or a negative error code.  Some of these codes are not errors per sae,
  135.  * but valid conditions such as EOF or EOC (End of Chunk).
  136.  }
  137. CONST
  138.  IFFERR_EOF            =  -1 ;    {  Reached logical END of file }
  139.  IFFERR_EOC            =  -2 ;    {  About to leave context      }
  140.  IFFERR_NOSCOPE        =  -3 ;    {  No valid scope for property }
  141.  IFFERR_NOMEM          =  -4 ;    {  Internal memory alloc failed}
  142.  IFFERR_READ           =  -5 ;    {  Stream read error           }
  143.  IFFERR_WRITE          =  -6 ;    {  Stream write error          }
  144.  IFFERR_SEEK           =  -7 ;    {  Stream seek error           }
  145.  IFFERR_MANGLED        =  -8 ;    {  Data in file is corrupt     }
  146.  IFFERR_SYNTAX         =  -9 ;    {  IFF syntax error            }
  147.  IFFERR_NOTIFF         =  -10;    {  Not an IFF file             }
  148.  IFFERR_NOHOOK         =  -11;    {  No call-back hook provided  }
  149.  IFF_RETURN2CLIENT     =  -12;    {  Client handler normal return}
  150.  
  151. {
  152.  MAKE_ID(a,b,c,d)        \
  153.         ((ULONG) (a)<<24 | (ULONG) (b)<<16 | (ULONG) (c)<<8 | (ULONG) (d))
  154.      }
  155. {
  156.  * Universal IFF identifiers.
  157.  }
  158.  ID_FORM = 1179603533;
  159.  ID_LIST = 1279873876;
  160.  ID_CAT  = 1128354848;
  161.  ID_PROP = 1347571536;
  162.  ID_NULL = 538976288;
  163.  
  164. {
  165.  * Ident codes for universally recognized local context items.
  166.  }
  167.  IFFLCI_PROP         = 1886547824;
  168.  IFFLCI_COLLECTION   = 1668246636;
  169.  IFFLCI_ENTRYHANDLER = 1701734500;
  170.  IFFLCI_EXITHANDLER  = 1702389860;
  171.  
  172.  
  173. {
  174.  * Control modes for ParseIFF() function.
  175.  }
  176.  IFFPARSE_SCAN         =  0;
  177.  IFFPARSE_STEP         =  1;
  178.  IFFPARSE_RAWSTEP      =  2;
  179.  
  180. {
  181.  * Control modes for StoreLocalItem().
  182.  }
  183.  IFFSLI_ROOT           =  1;      {  Store in default context       }
  184.  IFFSLI_TOP            =  2;      {  Store in current context       }
  185.  IFFSLI_PROP           =  3;      {  Store in topmost FORM OR LIST  }
  186.  
  187. {
  188.  * "Flag" for writing functions.  If you pass this value in as a size
  189.  * to PushChunk() when writing a file, the parser will figure out the
  190.  * size of the chunk for you.  (Chunk sizes >= 2**31 are forbidden by the
  191.  * IFF specification, so this works.)
  192.  }
  193.  IFFSIZE_UNKNOWN       =  -1;
  194.  
  195. {
  196.  * Possible call-back command values.  (Using 0 as the value for IFFCMD_INIT
  197.  * was, in retrospect, probably a bad idea.)
  198.  }
  199.  IFFCMD_INIT    = 0;       {  Prepare the stream for a session    }
  200.  IFFCMD_CLEANUP = 1;       {  Terminate stream session            }
  201.  IFFCMD_READ    = 2;       {  Read bytes from stream              }
  202.  IFFCMD_WRITE   = 3;       {  Write bytes to stream               }
  203.  IFFCMD_SEEK    = 4;       {  Seek on stream                      }
  204.  IFFCMD_ENTRY   = 5;       {  You just entered a new context      }
  205.  IFFCMD_EXIT    = 6;       {  You're about to leave a context     }
  206.  IFFCMD_PURGELCI= 7;       {  Purge a LocalContextItem            }
  207.  
  208. {  Backward compatibility.  Don't use these in new code.  }
  209.  IFFSCC_INIT    = IFFCMD_INIT;
  210.  IFFSCC_CLEANUP = IFFCMD_CLEANUP;
  211.  IFFSCC_READ    = IFFCMD_READ;
  212.  IFFSCC_WRITE   = IFFCMD_WRITE;
  213.  IFFSCC_SEEK    = IFFCMD_SEEK;
  214.  
  215. VAR IFFParseBase : pLibrary;
  216.  
  217. FUNCTION AllocIFF : pIFFHandle;
  218. FUNCTION AllocLocalItem(typ : LONGINT; id : LONGINT; ident : LONGINT; dataSize : LONGINT) : pLocalContextItem;
  219. PROCEDURE CloseClipboard(clipHandle : pClipboardHandle);
  220. PROCEDURE CloseIFF(iff : pIFFHandle);
  221. FUNCTION CollectionChunk(iff : pIFFHandle; typ : LONGINT; id : LONGINT) : LONGINT;
  222. FUNCTION CollectionChunks(iff : pIFFHandle; propArray : LONGINT; numPairs : LONGINT) : LONGINT;
  223. FUNCTION CurrentChunk(iff : pIFFHandle) : pContextNode;
  224. FUNCTION EntryHandler(iff : pIFFHandle; typ : LONGINT; id : LONGINT; position : LONGINT; handler : pHook; obj : POINTER) : LONGINT;
  225. FUNCTION ExitHandler(iff : pIFFHandle; typ : LONGINT; id : LONGINT; position : LONGINT; handler : pHook; obj : POINTER) : LONGINT;
  226. FUNCTION FindCollection(iff : pIFFHandle; typ : LONGINT; id : LONGINT) : pCollectionItem;
  227. FUNCTION FindLocalItem(iff : pIFFHandle; typ : LONGINT; id : LONGINT; ident : LONGINT) : pLocalContextItem;
  228. FUNCTION FindProp(iff : pIFFHandle; typ : LONGINT; id : LONGINT) : pStoredProperty;
  229. FUNCTION FindPropContext(iff : pIFFHandle) : pContextNode;
  230. PROCEDURE FreeIFF(iff : pIFFHandle);
  231. PROCEDURE FreeLocalItem(localItem : pLocalContextItem);
  232. FUNCTION GoodID(id : LONGINT) : LONGINT;
  233. FUNCTION GoodType(typ : LONGINT) : LONGINT;
  234. FUNCTION IDtoStr(id : LONGINT; buf : pCHAR) : pCHAR;
  235. PROCEDURE InitIFF(iff : pIFFHandle; flags : LONGINT; streamHook : pHook);
  236. PROCEDURE InitIFFasClip(iff : pIFFHandle);
  237. PROCEDURE InitIFFasDOS(iff : pIFFHandle);
  238. FUNCTION LocalItemData(localItem : pLocalContextItem) : POINTER;
  239. FUNCTION OpenClipboard(unitNumber : LONGINT) : pClipboardHandle;
  240. FUNCTION OpenIFF(iff : pIFFHandle; rwMode : LONGINT) : LONGINT;
  241. FUNCTION ParentChunk(contextNode : pContextNode) : pContextNode;
  242. FUNCTION ParseIFF(iff : pIFFHandle; control : LONGINT) : LONGINT;
  243. FUNCTION PopChunk(iff : pIFFHandle) : LONGINT;
  244. FUNCTION PropChunk(iff : pIFFHandle; typ : LONGINT; id : LONGINT) : LONGINT;
  245. FUNCTION PropChunks(iff : pIFFHandle; propArray : LONGINT; numPairs : LONGINT) : LONGINT;
  246. FUNCTION PushChunk(iff : pIFFHandle; typ : LONGINT; id : LONGINT; size : LONGINT) : LONGINT;
  247. FUNCTION ReadChunkBytes(iff : pIFFHandle; buf : POINTER; numBytes : LONGINT) : LONGINT;
  248. FUNCTION ReadChunkRecords(iff : pIFFHandle; buf : POINTER; bytesPerRecord : LONGINT; numRecords : LONGINT) : LONGINT;
  249. PROCEDURE SetLocalItemPurge(localItem : pLocalContextItem; purgeHook : pHook);
  250. FUNCTION StopChunk(iff : pIFFHandle; typ : LONGINT; id : LONGINT) : LONGINT;
  251. FUNCTION StopChunks(iff : pIFFHandle; propArray : LONGINT; numPairs : LONGINT) : LONGINT;
  252. FUNCTION StopOnExit(iff : pIFFHandle; typ : LONGINT; id : LONGINT) : LONGINT;
  253. PROCEDURE StoreItemInContext(iff : pIFFHandle; localItem : pLocalContextItem; contextNode : pContextNode);
  254. FUNCTION StoreLocalItem(iff : pIFFHandle; localItem : pLocalContextItem; position : LONGINT) : LONGINT;
  255. FUNCTION WriteChunkBytes(iff : pIFFHandle; buf : POINTER; numBytes : LONGINT) : LONGINT;
  256. FUNCTION WriteChunkRecords(iff : pIFFHandle; buf : POINTER; bytesPerRecord : LONGINT; numRecords : LONGINT) : LONGINT;
  257.  
  258. IMPLEMENTATION
  259.  
  260. FUNCTION AllocIFF : pIFFHandle;
  261. BEGIN
  262.   ASM
  263.     MOVE.L  A6,-(A7)
  264.     MOVEA.L IFFParseBase,A6
  265.     JSR -030(A6)
  266.     MOVEA.L (A7)+,A6
  267.     MOVE.L  D0,@RESULT
  268.   END;
  269. END;
  270.  
  271. FUNCTION AllocLocalItem(typ : LONGINT; id : LONGINT; ident : LONGINT; dataSize : LONGINT) : pLocalContextItem;
  272. BEGIN
  273.   ASM
  274.     MOVE.L  A6,-(A7)
  275.     MOVE.L  typ,D0
  276.     MOVE.L  id,D1
  277.     MOVE.L  ident,D2
  278.     MOVE.L  dataSize,D3
  279.     MOVEA.L IFFParseBase,A6
  280.     JSR -186(A6)
  281.     MOVEA.L (A7)+,A6
  282.     MOVE.L  D0,@RESULT
  283.   END;
  284. END;
  285.  
  286. PROCEDURE CloseClipboard(clipHandle : pClipboardHandle);
  287. BEGIN
  288.   ASM
  289.     MOVE.L  A6,-(A7)
  290.     MOVEA.L clipHandle,A0
  291.     MOVEA.L IFFParseBase,A6
  292.     JSR -252(A6)
  293.     MOVEA.L (A7)+,A6
  294.   END;
  295. END;
  296.  
  297. PROCEDURE CloseIFF(iff : pIFFHandle);
  298. BEGIN
  299.   ASM
  300.     MOVE.L  A6,-(A7)
  301.     MOVEA.L iff,A0
  302.     MOVEA.L IFFParseBase,A6
  303.     JSR -048(A6)
  304.     MOVEA.L (A7)+,A6
  305.   END;
  306. END;
  307.  
  308. FUNCTION CollectionChunk(iff : pIFFHandle; typ : LONGINT; id : LONGINT) : LONGINT;
  309. BEGIN
  310.   ASM
  311.     MOVE.L  A6,-(A7)
  312.     MOVEA.L iff,A0
  313.     MOVE.L  typ,D0
  314.     MOVE.L  id,D1
  315.     MOVEA.L IFFParseBase,A6
  316.     JSR -138(A6)
  317.     MOVEA.L (A7)+,A6
  318.     MOVE.L  D0,@RESULT
  319.   END;
  320. END;
  321.  
  322. FUNCTION CollectionChunks(iff : pIFFHandle; propArray : LONGINT; numPairs : LONGINT) : LONGINT;
  323. BEGIN
  324.   ASM
  325.     MOVE.L  A6,-(A7)
  326.     MOVEA.L iff,A0
  327.     MOVEA.L propArray,A1
  328.     MOVE.L  numPairs,D0
  329.     MOVEA.L IFFParseBase,A6
  330.     JSR -144(A6)
  331.     MOVEA.L (A7)+,A6
  332.     MOVE.L  D0,@RESULT
  333.   END;
  334. END;
  335.  
  336. FUNCTION CurrentChunk(iff : pIFFHandle) : pContextNode;
  337. BEGIN
  338.   ASM
  339.     MOVE.L  A6,-(A7)
  340.     MOVEA.L iff,A0
  341.     MOVEA.L IFFParseBase,A6
  342.     JSR -174(A6)
  343.     MOVEA.L (A7)+,A6
  344.     MOVE.L  D0,@RESULT
  345.   END;
  346. END;
  347.  
  348. FUNCTION EntryHandler(iff : pIFFHandle; typ : LONGINT; id : LONGINT; position : LONGINT; handler : pHook; obj : POINTER) : LONGINT;
  349. BEGIN
  350.   ASM
  351.     MOVE.L  A6,-(A7)
  352.     MOVEA.L iff,A0
  353.     MOVE.L  typ,D0
  354.     MOVE.L  id,D1
  355.     MOVE.L  position,D2
  356.     MOVEA.L handler,A1
  357.     MOVEA.L obj,A2
  358.     MOVEA.L IFFParseBase,A6
  359.     JSR -102(A6)
  360.     MOVEA.L (A7)+,A6
  361.     MOVE.L  D0,@RESULT
  362.   END;
  363. END;
  364.  
  365. FUNCTION ExitHandler(iff : pIFFHandle; typ : LONGINT; id : LONGINT; position : LONGINT; handler : pHook; obj : POINTER) : LONGINT;
  366. BEGIN
  367.   ASM
  368.     MOVE.L  A6,-(A7)
  369.     MOVEA.L iff,A0
  370.     MOVE.L  typ,D0
  371.     MOVE.L  id,D1
  372.     MOVE.L  position,D2
  373.     MOVEA.L handler,A1
  374.     MOVEA.L obj,A2
  375.     MOVEA.L IFFParseBase,A6
  376.     JSR -108(A6)
  377.     MOVEA.L (A7)+,A6
  378.     MOVE.L  D0,@RESULT
  379.   END;
  380. END;
  381.  
  382. FUNCTION FindCollection(iff : pIFFHandle; typ : LONGINT; id : LONGINT) : pCollectionItem;
  383. BEGIN
  384.   ASM
  385.     MOVE.L  A6,-(A7)
  386.     MOVEA.L iff,A0
  387.     MOVE.L  typ,D0
  388.     MOVE.L  id,D1
  389.     MOVEA.L IFFParseBase,A6
  390.     JSR -162(A6)
  391.     MOVEA.L (A7)+,A6
  392.     MOVE.L  D0,@RESULT
  393.   END;
  394. END;
  395.  
  396. FUNCTION FindLocalItem(iff : pIFFHandle; typ : LONGINT; id : LONGINT; ident : LONGINT) : pLocalContextItem;
  397. BEGIN
  398.   ASM
  399.     MOVE.L  A6,-(A7)
  400.     MOVEA.L iff,A0
  401.     MOVE.L  typ,D0
  402.     MOVE.L  id,D1
  403.     MOVE.L  ident,D2
  404.     MOVEA.L IFFParseBase,A6
  405.     JSR -210(A6)
  406.     MOVEA.L (A7)+,A6
  407.     MOVE.L  D0,@RESULT
  408.   END;
  409. END;
  410.  
  411. FUNCTION FindProp(iff : pIFFHandle; typ : LONGINT; id : LONGINT) : pStoredProperty;
  412. BEGIN
  413.   ASM
  414.     MOVE.L  A6,-(A7)
  415.     MOVEA.L iff,A0
  416.     MOVE.L  typ,D0
  417.     MOVE.L  id,D1
  418.     MOVEA.L IFFParseBase,A6
  419.     JSR -156(A6)
  420.     MOVEA.L (A7)+,A6
  421.     MOVE.L  D0,@RESULT
  422.   END;
  423. END;
  424.  
  425. FUNCTION FindPropContext(iff : pIFFHandle) : pContextNode;
  426. BEGIN
  427.   ASM
  428.     MOVE.L  A6,-(A7)
  429.     MOVEA.L iff,A0
  430.     MOVEA.L IFFParseBase,A6
  431.     JSR -168(A6)
  432.     MOVEA.L (A7)+,A6
  433.     MOVE.L  D0,@RESULT
  434.   END;
  435. END;
  436.  
  437. PROCEDURE FreeIFF(iff : pIFFHandle);
  438. BEGIN
  439.   ASM
  440.     MOVE.L  A6,-(A7)
  441.     MOVEA.L iff,A0
  442.     MOVEA.L IFFParseBase,A6
  443.     JSR -054(A6)
  444.     MOVEA.L (A7)+,A6
  445.   END;
  446. END;
  447.  
  448. PROCEDURE FreeLocalItem(localItem : pLocalContextItem);
  449. BEGIN
  450.   ASM
  451.     MOVE.L  A6,-(A7)
  452.     MOVEA.L localItem,A0
  453.     MOVEA.L IFFParseBase,A6
  454.     JSR -204(A6)
  455.     MOVEA.L (A7)+,A6
  456.   END;
  457. END;
  458.  
  459. FUNCTION GoodID(id : LONGINT) : LONGINT;
  460. BEGIN
  461.   ASM
  462.     MOVE.L  A6,-(A7)
  463.     MOVE.L  id,D0
  464.     MOVEA.L IFFParseBase,A6
  465.     JSR -258(A6)
  466.     MOVEA.L (A7)+,A6
  467.     MOVE.L  D0,@RESULT
  468.   END;
  469. END;
  470.  
  471. FUNCTION GoodType(typ : LONGINT) : LONGINT;
  472. BEGIN
  473.   ASM
  474.     MOVE.L  A6,-(A7)
  475.     MOVE.L  typ,D0
  476.     MOVEA.L IFFParseBase,A6
  477.     JSR -264(A6)
  478.     MOVEA.L (A7)+,A6
  479.     MOVE.L  D0,@RESULT
  480.   END;
  481. END;
  482.  
  483. FUNCTION IDtoStr(id : LONGINT; buf : pCHAR) : pCHAR;
  484. BEGIN
  485.   ASM
  486.     MOVE.L  A6,-(A7)
  487.     MOVE.L  id,D0
  488.     MOVEA.L buf,A0
  489.     MOVEA.L IFFParseBase,A6
  490.     JSR -270(A6)
  491.     MOVEA.L (A7)+,A6
  492.     MOVE.L  D0,@RESULT
  493.   END;
  494. END;
  495.  
  496. PROCEDURE InitIFF(iff : pIFFHandle; flags : LONGINT; streamHook : pHook);
  497. BEGIN
  498.   ASM
  499.     MOVE.L  A6,-(A7)
  500.     MOVEA.L iff,A0
  501.     MOVE.L  flags,D0
  502.     MOVEA.L streamHook,A1
  503.     MOVEA.L IFFParseBase,A6
  504.     JSR -228(A6)
  505.     MOVEA.L (A7)+,A6
  506.   END;
  507. END;
  508.  
  509. PROCEDURE InitIFFasClip(iff : pIFFHandle);
  510. BEGIN
  511.   ASM
  512.     MOVE.L  A6,-(A7)
  513.     MOVEA.L iff,A0
  514.     MOVEA.L IFFParseBase,A6
  515.     JSR -240(A6)
  516.     MOVEA.L (A7)+,A6
  517.   END;
  518. END;
  519.  
  520. PROCEDURE InitIFFasDOS(iff : pIFFHandle);
  521. BEGIN
  522.   ASM
  523.     MOVE.L  A6,-(A7)
  524.     MOVEA.L iff,A0
  525.     MOVEA.L IFFParseBase,A6
  526.     JSR -234(A6)
  527.     MOVEA.L (A7)+,A6
  528.   END;
  529. END;
  530.  
  531. FUNCTION LocalItemData(localItem : pLocalContextItem) : POINTER;
  532. BEGIN
  533.   ASM
  534.     MOVE.L  A6,-(A7)
  535.     MOVEA.L localItem,A0
  536.     MOVEA.L IFFParseBase,A6
  537.     JSR -192(A6)
  538.     MOVEA.L (A7)+,A6
  539.     MOVE.L  D0,@RESULT
  540.   END;
  541. END;
  542.  
  543. FUNCTION OpenClipboard(unitNumber : LONGINT) : pClipboardHandle;
  544. BEGIN
  545.   ASM
  546.     MOVE.L  A6,-(A7)
  547.     MOVE.L  unitNumber,D0
  548.     MOVEA.L IFFParseBase,A6
  549.     JSR -246(A6)
  550.     MOVEA.L (A7)+,A6
  551.     MOVE.L  D0,@RESULT
  552.   END;
  553. END;
  554.  
  555. FUNCTION OpenIFF(iff : pIFFHandle; rwMode : LONGINT) : LONGINT;
  556. BEGIN
  557.   ASM
  558.     MOVE.L  A6,-(A7)
  559.     MOVEA.L iff,A0
  560.     MOVE.L  rwMode,D0
  561.     MOVEA.L IFFParseBase,A6
  562.     JSR -036(A6)
  563.     MOVEA.L (A7)+,A6
  564.     MOVE.L  D0,@RESULT
  565.   END;
  566. END;
  567.  
  568. FUNCTION ParentChunk(contextNode : pContextNode) : pContextNode;
  569. BEGIN
  570.   ASM
  571.     MOVE.L  A6,-(A7)
  572.     MOVEA.L contextNode,A0
  573.     MOVEA.L IFFParseBase,A6
  574.     JSR -180(A6)
  575.     MOVEA.L (A7)+,A6
  576.     MOVE.L  D0,@RESULT
  577.   END;
  578. END;
  579.  
  580. FUNCTION ParseIFF(iff : pIFFHandle; control : LONGINT) : LONGINT;
  581. BEGIN
  582.   ASM
  583.     MOVE.L  A6,-(A7)
  584.     MOVEA.L iff,A0
  585.     MOVE.L  control,D0
  586.     MOVEA.L IFFParseBase,A6
  587.     JSR -042(A6)
  588.     MOVEA.L (A7)+,A6
  589.     MOVE.L  D0,@RESULT
  590.   END;
  591. END;
  592.  
  593. FUNCTION PopChunk(iff : pIFFHandle) : LONGINT;
  594. BEGIN
  595.   ASM
  596.     MOVE.L  A6,-(A7)
  597.     MOVEA.L iff,A0
  598.     MOVEA.L IFFParseBase,A6
  599.     JSR -090(A6)
  600.     MOVEA.L (A7)+,A6
  601.     MOVE.L  D0,@RESULT
  602.   END;
  603. END;
  604.  
  605. FUNCTION PropChunk(iff : pIFFHandle; typ : LONGINT; id : LONGINT) : LONGINT;
  606. BEGIN
  607.   ASM
  608.     MOVE.L  A6,-(A7)
  609.     MOVEA.L iff,A0
  610.     MOVE.L  typ,D0
  611.     MOVE.L  id,D1
  612.     MOVEA.L IFFParseBase,A6
  613.     JSR -114(A6)
  614.     MOVEA.L (A7)+,A6
  615.     MOVE.L  D0,@RESULT
  616.   END;
  617. END;
  618.  
  619. FUNCTION PropChunks(iff : pIFFHandle; propArray : LONGINT; numPairs : LONGINT) : LONGINT;
  620. BEGIN
  621.   ASM
  622.     MOVE.L  A6,-(A7)
  623.     MOVEA.L iff,A0
  624.     MOVEA.L propArray,A1
  625.     MOVE.L  numPairs,D0
  626.     MOVEA.L IFFParseBase,A6
  627.     JSR -120(A6)
  628.     MOVEA.L (A7)+,A6
  629.     MOVE.L  D0,@RESULT
  630.   END;
  631. END;
  632.  
  633. FUNCTION PushChunk(iff : pIFFHandle; typ : LONGINT; id : LONGINT; size : LONGINT) : LONGINT;
  634. BEGIN
  635.   ASM
  636.     MOVE.L  A6,-(A7)
  637.     MOVEA.L iff,A0
  638.     MOVE.L  typ,D0
  639.     MOVE.L  id,D1
  640.     MOVE.L  size,D2
  641.     MOVEA.L IFFParseBase,A6
  642.     JSR -084(A6)
  643.     MOVEA.L (A7)+,A6
  644.     MOVE.L  D0,@RESULT
  645.   END;
  646. END;
  647.  
  648. FUNCTION ReadChunkBytes(iff : pIFFHandle; buf : POINTER; numBytes : LONGINT) : LONGINT;
  649. BEGIN
  650.   ASM
  651.     MOVE.L  A6,-(A7)
  652.     MOVEA.L iff,A0
  653.     MOVEA.L buf,A1
  654.     MOVE.L  numBytes,D0
  655.     MOVEA.L IFFParseBase,A6
  656.     JSR -060(A6)
  657.     MOVEA.L (A7)+,A6
  658.     MOVE.L  D0,@RESULT
  659.   END;
  660. END;
  661.  
  662. FUNCTION ReadChunkRecords(iff : pIFFHandle; buf : POINTER; bytesPerRecord : LONGINT; numRecords : LONGINT) : LONGINT;
  663. BEGIN
  664.   ASM
  665.     MOVE.L  A6,-(A7)
  666.     MOVEA.L iff,A0
  667.     MOVEA.L buf,A1
  668.     MOVE.L  bytesPerRecord,D0
  669.     MOVE.L  numRecords,D1
  670.     MOVEA.L IFFParseBase,A6
  671.     JSR -072(A6)
  672.     MOVEA.L (A7)+,A6
  673.     MOVE.L  D0,@RESULT
  674.   END;
  675. END;
  676.  
  677. PROCEDURE SetLocalItemPurge(localItem : pLocalContextItem; purgeHook : pHook);
  678. BEGIN
  679.   ASM
  680.     MOVE.L  A6,-(A7)
  681.     MOVEA.L localItem,A0
  682.     MOVEA.L purgeHook,A1
  683.     MOVEA.L IFFParseBase,A6
  684.     JSR -198(A6)
  685.     MOVEA.L (A7)+,A6
  686.   END;
  687. END;
  688.  
  689. FUNCTION StopChunk(iff : pIFFHandle; typ : LONGINT; id : LONGINT) : LONGINT;
  690. BEGIN
  691.   ASM
  692.     MOVE.L  A6,-(A7)
  693.     MOVEA.L iff,A0
  694.     MOVE.L  typ,D0
  695.     MOVE.L  id,D1
  696.     MOVEA.L IFFParseBase,A6
  697.     JSR -126(A6)
  698.     MOVEA.L (A7)+,A6
  699.     MOVE.L  D0,@RESULT
  700.   END;
  701. END;
  702.  
  703. FUNCTION StopChunks(iff : pIFFHandle; propArray : LONGINT; numPairs : LONGINT) : LONGINT;
  704. BEGIN
  705.   ASM
  706.     MOVE.L  A6,-(A7)
  707.     MOVEA.L iff,A0
  708.     MOVEA.L propArray,A1
  709.     MOVE.L  numPairs,D0
  710.     MOVEA.L IFFParseBase,A6
  711.     JSR -132(A6)
  712.     MOVEA.L (A7)+,A6
  713.     MOVE.L  D0,@RESULT
  714.   END;
  715. END;
  716.  
  717. FUNCTION StopOnExit(iff : pIFFHandle; typ : LONGINT; id : LONGINT) : LONGINT;
  718. BEGIN
  719.   ASM
  720.     MOVE.L  A6,-(A7)
  721.     MOVEA.L iff,A0
  722.     MOVE.L  typ,D0
  723.     MOVE.L  id,D1
  724.     MOVEA.L IFFParseBase,A6
  725.     JSR -150(A6)
  726.     MOVEA.L (A7)+,A6
  727.     MOVE.L  D0,@RESULT
  728.   END;
  729. END;
  730.  
  731. PROCEDURE StoreItemInContext(iff : pIFFHandle; localItem : pLocalContextItem; contextNode : pContextNode);
  732. BEGIN
  733.   ASM
  734.     MOVE.L  A6,-(A7)
  735.     MOVEA.L iff,A0
  736.     MOVEA.L localItem,A1
  737.     MOVEA.L contextNode,A2
  738.     MOVEA.L IFFParseBase,A6
  739.     JSR -222(A6)
  740.     MOVEA.L (A7)+,A6
  741.   END;
  742. END;
  743.  
  744. FUNCTION StoreLocalItem(iff : pIFFHandle; localItem : pLocalContextItem; position : LONGINT) : LONGINT;
  745. BEGIN
  746.   ASM
  747.     MOVE.L  A6,-(A7)
  748.     MOVEA.L iff,A0
  749.     MOVEA.L localItem,A1
  750.     MOVE.L  position,D0
  751.     MOVEA.L IFFParseBase,A6
  752.     JSR -216(A6)
  753.     MOVEA.L (A7)+,A6
  754.     MOVE.L  D0,@RESULT
  755.   END;
  756. END;
  757.  
  758. FUNCTION WriteChunkBytes(iff : pIFFHandle; buf : POINTER; numBytes : LONGINT) : LONGINT;
  759. BEGIN
  760.   ASM
  761.     MOVE.L  A6,-(A7)
  762.     MOVEA.L iff,A0
  763.     MOVEA.L buf,A1
  764.     MOVE.L  numBytes,D0
  765.     MOVEA.L IFFParseBase,A6
  766.     JSR -066(A6)
  767.     MOVEA.L (A7)+,A6
  768.     MOVE.L  D0,@RESULT
  769.   END;
  770. END;
  771.  
  772. FUNCTION WriteChunkRecords(iff : pIFFHandle; buf : POINTER; bytesPerRecord : LONGINT; numRecords : LONGINT) : LONGINT;
  773. BEGIN
  774.   ASM
  775.     MOVE.L  A6,-(A7)
  776.     MOVEA.L iff,A0
  777.     MOVEA.L buf,A1
  778.     MOVE.L  bytesPerRecord,D0
  779.     MOVE.L  numRecords,D1
  780.     MOVEA.L IFFParseBase,A6
  781.     JSR -078(A6)
  782.     MOVEA.L (A7)+,A6
  783.     MOVE.L  D0,@RESULT
  784.   END;
  785. END;
  786.  
  787. END. (* UNIT IFFPARSE *)
  788.  
  789.  
  790.  
  791.  
  792.